<form id="dialog-add-content" class="dialog-add-content" name="contract_form" novalidate style="width:800px;">

    <div class="table-header mt5" style="position: relative; margin-bottom: 10px;">
        <div class="clearfix" style="padding-bottom:4px;">
            <span class="fl f14 lh30 text-indent">基本信息</span>
        </div>
    </div>
    <div class="form-group mt10 clearfix">
        <span class="col-sm-4 control-label form-cell"><em class="c-red">*&nbsp;</em>合同号：</span>

        <div class="col-sm-10">
            <input ng-model="data.ContractNum" name="ContractNum" class="input-text" type="text" required>
        </div>

        <div ng-messages="contract_form.ContractNum.$error"
             ng-show="contract_form.$submitted || contract_form.ContractNum.$touched">
            <p class="error" ng-message="required">不能为空。</p>
        </div>
    </div>

    <div class="form-group mt10 clearfix">
        <span class="col-sm-4 control-label form-cell"><em class="c-red">*&nbsp;</em>合同甲方：</span>

        <div class="col-sm-10">
            <input ng-model="data.PartyA" name="PartyA" class="input-text" type="text" required>
        </div>

        <div ng-messages="contract_form.PartyA.$error"
             ng-show="contract_form.$submitted || contract_form.PartyA.$touched">
            <p class="error" ng-message="required">不能为空。</p>
        </div>
    </div>

    <div class="form-group mt10 clearfix">
        <span class="col-sm-4 control-label form-cell"><em class="c-red">*&nbsp;</em>购买类型：</span>

        <div class="col-sm-10 clearfix">
            <label class="radio fl" style="margin:0 50px 0 0">
                <input type="radio" name="contract_type" value="1" ng-model="data.ContractType" disabled>
                <span>新增</span>
            </label>

            <label class="radio fl" style="margin-top: 0">
                <input type="radio" name="contract_type" value="2" ng-model="data.ContractType" disabled>
                <span>增购</span>
            </label>
        </div>
    </div>
    <div class="form-group mt10 clearfix">
        <span class="fl lh30 col-sm-4 form-cell"><em class="c-red">*&nbsp;</em>租期：</span>

        <div class="col-sm-14 clearfix ">
            <input type="text" class="input-text input-data fl ng-pristine ng-valid ng-touched" readonly=""
                   ui-date="" format="yyyy-MM-dd" id="start_date" name="start_date" max-date="#F{$dp.$D(\'end_date'\)}"
                   ng-model="data.BeginOn" required>
            <span class="fl" ng-messages="contract_form.start_date.$error"
                 ng-show="contract_form.$submitted || contract_form.start_date.$touched">
                <span class="error" ng-message="required">不能为空。</span>
            </span>
            <span class="fl lh30">&nbsp;&nbsp;-&nbsp;&nbsp;</span>
            <input type="text" class="input-text input-data fl ng-pristine ng-untouched ng-valid" readonly=""
                   ui-date="" format="yyyy-MM-dd" id="end_date" name="end_date" min-date="#F{$dp.$D(\'start_date'\)}"
                   ng-model="data.EndOn" required>
            <span class="fl" ng-messages="contract_form.end_date.$error"
                 ng-show="contract_form.$submitted || contract_form.end_date.$touched">
                <span class="error" ng-message="required">不能为空。</span>
            </span>
        </div>
    </div>
    <div class="tab f14 mt15 clearfix">
        <ul>
            <li>
                授权信息
            </li>
        </ul>
        <div class="tab-bottom-line"></div>
    </div>
    <div class="sheet">
        <table width="100%" class="mt15">
            <thead>
            <tr>
                <th height="34" style="width:60px">序号</th>
                <th>套餐包名称</th>
                <th style="width:120px">授权项目数</th>
                <th ng-if="data.ContractId" style="width:120px">绑定项目数</th>
                <th ng-if="data.ContractId" style="width:300px">可用项目数</th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="item in data.packages">
                <td width="60" height="34" class="ng-binding">{{$index+1}}</td>
                <td>{{item.friendly_name}}</td>
                <td>
                    <input type="number" integer ng-model="item.total_num" required name="total_num_{{$index}}">

                    <span class="fl" ng-messages="contract_form['total_num_{{$index}}'].$error"
                                  ng-show="contract_form.$submitted || contract_form['total_num_{{$index}}'].$touched">
                        <span class="error" ng-message="required">不能为空。</span>
                    </span>
                </td>
                <td ng-if="data.ContractId">{{item.used_num}}</td>
                <td ng-if="data.ContractId">{{item.total_num-item.used_num}}</td>
            </tr>
            </tbody>
        </table>
    </div>
</form>